package ae.pcfc.etks.cld.service.dao;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

import org.hibernate.LockMode;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.ProjectionList;
import org.springframework.dao.DataAccessException;


public interface GenericDAO<T, ID extends Serializable>
{
	public T load(ID id)
			throws DataAccessException;

	public T get(ID id)
			throws DataAccessException;

	public boolean contains(T t)
			throws DataAccessException;

	public void refresh(T t, LockMode lockMode)
			throws DataAccessException;

	public void refresh(T t)
			throws DataAccessException;

	public Serializable save(T t)
			throws DataAccessException;

	public void saveOrUpdate(T t)
			throws DataAccessException;

	public void saveOrUpdateAll(Collection<T> entities)
			throws DataAccessException;

	public void update(T t, LockMode lockMode)
			throws DataAccessException;

	public void update(T t)
			throws DataAccessException;

	public void delete(T t, LockMode lockMode)
			throws DataAccessException;

	public void delete(T t)
			throws DataAccessException;
		
	public void deleteByProperty(String property,Object value)
			throws DataAccessException;	

	public void deleteAll(Collection<T> entities)
			throws DataAccessException;

	public List<T> find(String queryString, Object value)
			throws DataAccessException;

	public List<T> find(String queryString, Object... values)
			throws DataAccessException;

	public List<T> find(String queryString)
			throws DataAccessException;

	public List<T> list()
			throws DataAccessException;

	public List<T> findByNamedQuery(String queryName)
			throws DataAccessException;

	public List<T> findByNamedQuery(String queryName, Object value)
			throws DataAccessException;

	public List<T> findByNamedQuery(String queryName, Object... values)
			throws DataAccessException;

	public void flushAndClear();

	public void deleteById(ID id)
			throws DataAccessException;

	public int deleteAll()
			throws DataAccessException;

	public List<T> findByCriteria(Criterion... criterion)
			throws DataAccessException;

	public List<T> findByCriteria(ProjectionList projectionList, Criterion... criterion)
			throws DataAccessException;

	public int getCount()
			throws DataAccessException;

	public int getCount(Criterion... criterion)
			throws DataAccessException;

	public T merge(T detachedInstance)
			throws DataAccessException;

	public List<T> findByCriteria(Order[] orders, Criterion... criterion)
			throws DataAccessException;

	public List<T> findByCriteria(Order[] orders, ProjectionList projectionList, Criterion... criterion)
			throws DataAccessException;

	@SuppressWarnings("unchecked")
	public List<T> findByCriteria(Order[] orders, ProjectionList projectionList,Class transformTo, Criterion... criterion)
			throws DataAccessException;	

	public List<T> findByExample(T exampleInstance, String... excludeProperty)
			throws DataAccessException;

	public List<T> findByExample(final T exampleInstance, final MatchMode matchMode)
			throws DataAccessException;

	public List<T> findByExample(final T exampleInstance, final MatchMode matchMode, final String... excludeProperty)
			throws DataAccessException;

	public List<T> findAllByProperty(String propertyName, Object value)
			throws DataAccessException;
}
